$ambi = $ARGV[0];
chomp $ambi;
$inputfile = $ARGV[1];
chomp $inputfile;
open(BUFF1,$ambi);
open(BUFF2,$inputfile);
open(WRBUFF,">out_ambi_$inputfile");
#print $ambi."\t".$inputfile."\n";
while($line = <BUFF1>)
{
	$line =~ s/\n//g;
	$line =~ s/\s//g;
	$line =~ s/\r//g;
	#print $line;
	$hash{$line} = 1;


}
while($line = <BUFF2>)
{
        $line =~ s/\n//g;
        $line =~ s/\t//g;
        $line =~ s/\r//g;
	@array = split(" ",$line);
        #$array[1] =~ s/\n//g;
	#$array[1] =~ s/\t//g;
	$array[1] =~ s/\s//g;
	#print $array[1]."\n";
	if($hash{$array[1]} ==1)
	{ 
		print WRBUFF $line."\n";
	}
}
